local skel = fk.CreateSkill {
  name = "lb__qingshi",
  max_branches_use_time = function(self, player)
    local room = Fk:currentRoom()
    local list = {}
    for _, to in ipairs(room.players) do
      list[tostring(to.id)] = { [Player.HistoryGame] = 1 }
    end
    return list
  end
}

Fk:loadTranslationTable {
  ["lb__qingshi"] = "擎世",
  [":lb__qingshi"] = "每名角色限一次，当未成为过你<a href=':lb__chouzhuo'><font color='red'>〖仇灼〗</font></a>目标的角色受到伤害时，你可以将此伤害转移给你。",

  ["#lb__qingshi"] = "擎世：你可以将 %dest 受到的%arg点%arg2伤害转移给你",

  ["@[player]lb__qingshi"] = "擎世",

  ["$lb__qingshi1"] = "烙印纷争之铭！",
  ["$lb__qingshi2"] = "铭记这道痛楚！",
}

skel:addEffect(fk.DetermineDamageInflicted, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and target ~= player
        and not table.contains(player:getTableMark("@[player]lb__chouzhuo"), target.id)
        and skel:withinBranchTimesLimit(player, tostring(target.id), Player.HistoryGame)
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player,
      {
        skill_name = skel.name,
        prompt = "#lb__qingshi::" .. target.id .. ":" .. data.damage .. ":" .. Fk:getDamageNatureName(data.damageType),
      })
  end,
  on_use = function(self, event, target, player, data)
    player:addSkillBranchUseHistory(skel.name, tostring(target.id))
    local room = player.room
    local n = data.damage
    room:addTableMarkIfNeed(player, "@[player]lb__qingshi", target.id)
    data:preventDamage()
    if not player.dead then
      room:damage {
        from = data.from,
        to = player,
        damage = n,
        damageType = data.damageType,
        skillName = data.skillName,
        chain = data.chain,
        card = data.card,
      }
    end
  end,
})

skel:addLoseEffect(function (self, player, is_death)
  player.room:setPlayerMark(player, "@[player]lb__qingshi", 0)
end)

return skel